<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MdiWin Demo - edit</title>
    <uieip type="file" value="inc" src="/yqwin/easyui/include.txt" cache="true" minute="1440"></uieip>
    <uieip type="file" value="css" src="/yqwin/css/yqwin.min" cache="false"></uieip>
    <uieip type="file" value="js" src="/yqwin/data/yqwin.min" cache="false"></uieip>
</head>

<body>
    <h1>yqForeignKey</h1>
    <select id="cc" style="width:250px;"></select>
    <p></p>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:setValue()">setValue</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:getValue()">getValue</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:clearun()">clearun</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:disable()">disable</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:enable()">enable</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:destroy()">destroy</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:init_1()">init_1</a>
    <p></p>
    <select id="cc2" style="width:250px;"></select>
    <p></p>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:setValue2()">setValue</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:getValue2()">getValue</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:clearun2()">clearun</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:disable2()">disable</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:enable2()">enable</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:destroy2()">destroy</a>
    <a href="#" class="easyui-linkbutton" data-options="" onclick="javascript:init_2()">init_2</a>
    <script>
        $(function () {
            init_1();
            init_2();
        });

        function init_1(){
            $("#cc").yqForeignKey({
                displayType: 1,                 //显示类型, 1--下拉列表 2--查询窗体
                dbname: "yqbase",               //数据库
                tbname: "foreignkey",           //表
                tempno: 100,                    //实例 
                addWhere: "",                   //额外条件
                order: "",                      //排序
                isPage: true,                   //分页
                pageSize: 5,
                valueMember: "sid",             //值字段
                displayMember: "textbox",       //显示字段
            });
        }
        
        function init_2(){
            $("#cc2").yqForeignKey({
                displayType: 2,                 //显示类型, 1--下拉列表 2--查询窗体
                dbname: "yqbase",               //数据库
                tbname: "foreignkey",           //表
                tempno: 100,                    //实例 
                addWhere: "",                   //额外条件
                order: "",                      //排序
                isPage: true,                   //分页
                pageSize: 5,
                valueMember: "sid",             //值字段
                displayMember: "textbox",       //显示字段
            });
        }

        function setValue() {
            $("#cc").yqForeignKey("setValue", "sid-1");
        }

        function getValue() {
            var val = $("#cc").yqForeignKey("getValue");
            if (val == "") {
                console.log("空");
            }
            else if (val == null) {
                console.log("null");
            }
            console.log("getValue", $("#cc").yqForeignKey("getValue"));
        }

        function clearun() {
            $("#cc").yqForeignKey("clear");
        }

        function disable() {
            $("#cc").yqForeignKey("disable");
        }
        function enable() {
            $("#cc").yqForeignKey("enable");
        }

        function destroy() {
            $("#cc").yqForeignKey("destroy");
        }


        function setValue2() {
            $("#cc2").yqForeignKey("setValue", "sid-1");
        }

        function getValue2() {
            var val = $("#cc2").yqForeignKey("getValue");
            if (val == "") {
                console.log("空");
            }
            else if (val == null) {
                console.log("null");
            }
            console.log("getValue", $("#cc2").yqForeignKey("getValue"));
        }

        function clearun2() {
            $("#cc2").yqForeignKey("clear");
        }

        function disable2() {
            $("#cc2").yqForeignKey("disable");
        }
        function enable2() {
            $("#cc2").yqForeignKey("enable");
        }

        function destroy2() {
            $("#cc2").yqForeignKey("destroy");
        }

 

    </script>
</body>

</html>